package com.task.mall.service.impl;

import com.task.mall.bean.Login;
import com.task.mall.bean.Password;
import com.task.mall.bean.User;
import com.task.mall.dao.UserDao;
import com.task.mall.dao.impl.UserDaoImpl;
import com.task.mall.service.UserService;
import java.util.List;

public class UserServiceImpl implements UserService {
    private UserDao userDao = new UserDaoImpl();

    @Override
    public List<User> queryAllUser() {
        return userDao.queryAllUser();
    }

    @Override
    public int deleteUser(String id) {
        return userDao.deleteUser(id);
    }

    @Override
    public List<User> searchUser(String word) {
        return userDao.searchUser(word);
    }

    @Override
    public int login(User user) {
        return userDao.login(user);
    }

    @Override
    public Login getLoginInfo(String email) {
        return userDao.getLoginInfo(email);
    }

    @Override
    public int signup(User user) {
        return userDao.signup(user);
    }

    @Override
    public User data(String token) {
        User userData = userDao.getUserData(token);
        String name = userData.getName();
        userData.setRecipient(name);
        return userData;
    }

    @Override
    public int changePwd(Password password) {
        return userDao.changePwd(password);
    }

    @Override
    public int updateUserData(User user) {
        return userDao.updateUserData(user);
    }
}
